###############################################################################
#
# Copyright (c) 2011 Rainmaker Entertainment
# All Rights Reserved.
#
# This file contains unpublished confidential and proprietary
# information of Rainmaker Entertainment.  The contents of this file
# may not be copied or duplicated, in whole or in part, by any
# means, electronic or hardcopy, without the express prior
# written permission of Rainmaker Entertainment.
#
#    $HeadURL: http://pt/src/trunk/maya/outsource/rnkOutsourceChecker/operations/shader.py $
#    $Revision: 67856 $
#    $Author: wmakari $
#    $Date: 2013-09-17 18:23:18 -0700 (Tue, 17 Sep 2013) $
#
###############################################################################

###############################################################################
## INFOS
###############################################################################

# Geo checks


###############################################################################
## MODULES
###############################################################################

import traceback
import re

try :
    import maya.cmds as cmds
    import maya.mel as mel
    import maya.OpenMaya as OpenMaya
except :
    traceback.print_exc()
    print "Can't load Maya modules."
    

import rnkAssetChecks.shader as rnkAssetChecksShader
reload(rnkAssetChecksShader)

import core
reload(core)


###############################################################################
## FUNCTIONS
###############################################################################  

def checkSidedness(assetRoot, *args, **kw):

	issues = rnkAssetChecksShader.checkSidedness(assetRoot)
	if len(issues) == 0 :    
		return core.checkResult(allowPublish=True, msg="Everything is OK")

	else :           
		return core.checkResult(allowPublish=True, msg="These geometries are double-sided", nodes=issues, warning=True)

checkSidedness.modifiedScene = False
checkSidedness.uiName        = 'Check Geometries Sidedness'
checkSidedness.revision      = "$Revision: 67856 $".split()[1]
checkSidedness.__doc__       = rnkAssetChecksShader.checkSidedness.__doc__


def checkOpposite(assetRoot, *args, **kw):
	
	issues = rnkAssetChecksShader.checkOpposite(assetRoot)

	if len(issues) == 0 : 
		return core.checkResult(allowPublish=True, msg="Everything is OK")
	else :           
		return core.checkResult(allowPublish=False, msg="These geometries are opposite", nodes=issues)

checkOpposite.modifiedScene = False
checkOpposite.uiName        = 'Check Geometries Opposite'
checkOpposite.revision      = "$Revision: 67856 $".split()[1]
checkOpposite.__doc__       = rnkAssetChecksShader.checkOpposite.__doc__